package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.entity.NursingProject;
import com.zzyl.service.NursingPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static com.zzyl.base.ResponseResult.success;

@RestController
@Api(tags = "护理计划")
@RequestMapping("/nursing")
public class NursingPlanController {

    @Autowired
    private NursingPlanService nursingPlanService;

    @GetMapping("/plan/search")
    @ApiOperation("护理计划分页查询")
    public ResponseResult paginatedQueries(String name, Integer status,
                                           @RequestParam(defaultValue = "1")Integer pageNum,
                                           @RequestParam(defaultValue = "5")Integer pageSize){
        PageResponse pageResponse=nursingPlanService.paginatedQueries(name,status,pageSize,pageNum);
        return ResponseResult.success(pageResponse);
    }

    /**
     * 获取所有护理计划
     * @return
     */
    @GetMapping()
    @ApiOperation("查询所有护理计划")
    public ResponseResult getByIdWithNursing(){
        return success(nursingPlanService.getAllQueries());
    }
}
